pkg_name=zlib
version=1.2.8
src_dir=$src_dir_root/$pkg_name-$version
url=http://zlib.net/$pkg_name-$version.tar.xz

cd "$src_dir_root"
rm -Rf "$pkg_name-$version"
tar Jxf "$pkg_name-$version.tar.xz"

cd "$src_dir"

export CFLAGS=-O0
export CHOST=$gnu_target
./configure --prefix=/

make

install_tmp_dir=/tmp/$pkg_name-cross-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"
unset CHOST
unset CFLAGS

install_dirs_in_sysroot "$builders_dir_root/$pkg_name/runtime-cross.dirs" "$sysroot/"
install_files_in_sysroot "$builders_dir_root/$pkg_name/runtime-cross.files" "$install_tmp_dir/" "$sysroot/"
install_links_in_sysroot "$builders_dir_root/$pkg_name/runtime-cross.links" "$sysroot/"
install_dirs_in_sysroot  "$builders_dir_root/$pkg_name/devel-cross.dirs" "$sysroot/"
install_files_in_sysroot "$builders_dir_root/$pkg_name/devel-cross.files" "$install_tmp_dir/" "$sysroot/"
install_links_in_sysroot "$builders_dir_root/$pkg_name/devel-cross.links" "$sysroot/"
elf_strip_in_sysroot "$builders_dir_root/$pkg_name/elf-strip-cross" "$sysroot/"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
